#ifndef _ILOGS_H_
#define _ILOGS_H_

#pragma pack(push, 1)

#define LOG_FIELD_NAME_LEN 15
#define LOG_FIELD_TYPE_LEN 7

typedef struct TagFieldSturct FieldSturct;

struct TagFieldSturct {
    char name[LOG_FIELD_NAME_LEN + 1];
    char type[LOG_FIELD_TYPE_LEN + 1];
    UINT size;
    UINT index;
    UINT key;
    UINT value;
    UINT level;
};

#pragma pack(pop)

#define LOG_KEY_OP             "op"
#define LOG_OP_VALUE_LEN       15
#define LOG_KEY_DATABASE       "database"
#define LOG_DATABASE_VALUE_LEN 15
#define LOG_KEY_LEVEL          "level"
#define LOG_LEVEL_VALUE_LEN    15
#define LOG_KEY_TABLENAME      "table"
#define LOG_OP_TABLENAME_LEN   15

interface ITableStruct : public IBase
{
    std_method(AddTableRecord)(const FieldSturct& field) PURE;
    std_method(GetTableRecord)(FieldSturct* field, ULONG loop) PURE;
    std_method(GetTableRecords)(FieldSturct fields[], ULONG count) PURE;
    std_method(ClearTableRecord)() PURE;
    std_method(GetFieldsCount)(ULONG& count) PURE;
    std_method(SetKeyValue)(LPCSTR key, LPCSTR value) PURE;
    std_method(GetKeyValue)(LPCSTR key, LPSTR value) PURE;
    std_method_(UINT, IsExist)() PURE;
    std_method_(UINT, GetOp)() PURE;
    std_method_(UINT, GetLevel)() PURE;
};

// {2B0185A7-9E1E-4148-9FDB-0C2650818B41}
_DEF_IID(IID_ITableStruct, 0x2b0185a7, 0x9e1e, 0x4148, 0x9f, 0xdb, 0xc, 0x26, 0x50, 0x81, 0x8b, 0x41);

interface ILogDataBase : public IBase
{
    std_method(IsTableExist)(LPCSTR name, IBase** pTable) PURE;
    std_method(SyncTable)(LPCSTR name, IBase* pBase) PURE;
    std_method(InsertTable)(UCHAR* pBuf, ULONG uSize) PURE;
};

// {013223D9-5776-49BF-B0E9-BD70960E0B4C}
_DEF_IID(IID_ILogDataBase, 0x13223d9, 0x5776, 0x49bf, 0xb0, 0xe9, 0xbd, 0x70, 0x96, 0xe, 0xb, 0x4c);

// {34F9B3BF-6F56-4058-9DCD-04D9A5F0174B}
_DEF_CLSID(CLSID_CLogDataBase, 0x34f9b3bf, 0x6f56, 0x4058, 0x9d, 0xcd, 0x4, 0xd9, 0xa5, 0xf0, 0x17, 0x4b);

interface ILogs : public IBase
{
    std_method(PostLog)(UCHAR* pBuf, ULONG Size) PURE;
    std_method(AddObject)(LPCSTR name, UINT len, IBase* pFilter) PURE;
    std_method(ReleaseObject)(LPCSTR name, UINT len) PURE;
};

// {FEA6E51E-1B18-47FA-8066-F5C2B388D2A6}
_DEF_IID(IID_ILogs, 0xfea6e51e, 0x1b18, 0x47fa, 0x80, 0x66, 0xf5, 0xc2, 0xb3, 0x88, 0xd2, 0xa6);

// {99103D46-735F-44EE-A6F1-2C94DF20901E}
_DEF_CLSID(CLSID_CLogs, 0x99103d46, 0x735f, 0x44ee, 0xa6, 0xf1, 0x2c, 0x94, 0xdf, 0x20, 0x90, 0x1e);

#endif
